package com.face.server.convert;

import com.face.server.vo.DormAdmin;
import com.face.server.entity.DormitoryAdmin;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ryan on 2018/1/26.
 */
public class DormitoryAdmin2DormAdmin {
    public static DormAdmin convert(DormitoryAdmin dormAdmin){
        DormAdmin admin=new DormAdmin();
        admin.setDormitoryNum(dormAdmin.getDormitoryBuild().getBuildingNum());
        admin.setIdNumber(dormAdmin.getIdentity());
        admin.setName(dormAdmin.getName());
        admin.setPhone(dormAdmin.getPhone());
        return admin;
    }

    public static List<DormAdmin> convert(List<DormitoryAdmin> dormitoryAdmins){
        List<DormAdmin> dormAdmins=new ArrayList<DormAdmin>();
        for (DormitoryAdmin dormitoryAdmin:dormitoryAdmins){
            dormAdmins.add(convert(dormitoryAdmin));
        }
        return dormAdmins;
    }
}
